package keke;

import java.util.Scanner;

class IllegalScoreException extends Exception{
	IllegalScoreException(){
		
	}   
	IllegalScoreException(String score){
		super(score);     
    } 
}
class IllegalNameException extends RuntimeException{
	IllegalNameException(){
		
	}   
	IllegalNameException(String name){
		super(name);     
    } 
}
class Student2{
	private String name;
	private int score;
	public Student2(String name, int score) {
		super();
		this.name = name;
		this.score = score;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) throws IllegalNameException{
		if(name.charAt(0)>='0'&&name.charAt(0)<='9') throw new IllegalNameException("the first char of name must not be digit, name="+name);
		this.name = name;
	}
	public int getScore() {
		return score;
	}
	public void setScore(int score) {
		this.score = score;
	}
	@Override
	public String toString() {
		return "Student [name=" + name + ", score=" + score + "]";
	}
	public int addScore(int score) throws IllegalScoreException{
		if(score<0||score>100)
			throw new IllegalScoreException("score out of range, score="+score);
		return score;
	}
}
public class Main0604 {
	public static void main(String[] args){
		Scanner in=new Scanner(System.in );
		String str;
		while(in.hasNext()){
			str=in.next();
			if(!str.equals("new"))
				break;
			try{
				String name=in.next();
				int score=in.nextInt();
				Student2 student= new Student2(name,score);
				student.setName(name);
				student.addScore(score);
				System.out.println(student);
			}catch(IllegalNameException e){
				System.out.println(e);
				break;
			}catch(IllegalScoreException e){
				System.out.println(e);
				continue;
			}
		}
		in.close();
		System.out.println("scanner closed");
	}
}
